package com.cmc.cloud.cmclink.doc.api.document.req.si;

/**
 * @author 周贤
 * @date 2025/7/29
 */

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.Date;

import static com.cmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "管理后台 - 提单主信息 主表需前端传递数据")
@Valid
public class BlnoBaseInfoDto {
    @Schema(description = "主键 有主键就更新 没有主键就创建", requiredMode = Schema.RequiredMode.REQUIRED, example = "29756")
    private Long id;

    @Schema(description = "订舱号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.bookingno.notblank")
    @Length(max = 20, message = "blno.bookingno.length")
    private String bookingNo;

    @Schema(description = "so主表id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long soId;

    @Schema(description = "提单号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.blno.notblank")
    @Length(max = 50, message = "blno.blno.length")
    private String blNo;

    @Schema(description = "客户业务号", requiredMode = Schema.RequiredMode.REQUIRED)
    private String referenceNo;

    @Schema(description = "始发港提单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1", 
           allowableValues = {"SI01(草稿)", "SI02(SI 待审核)", "SI03(SI已确认)", "SI04(待确认 Draft 件)", "SI05(已确认 Draft 件)", "SI06(提单准备好签发)"})
    @Length(max = 20, message = "blno.sistatus.length")
    private String siStatus;

    @Schema(description = "提单拆并单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private String splitCombineType;

    @Schema(description = "路径id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20782")
    @NotNull(message = "{blno.routeid.notnull}")
    private Long routeId;

    @Schema(description = "接货地", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.porcode.notblank")
    @Length(max = 5, message = "blno.porcode.length")
    private String porCode;

    @Schema(description = "装货港", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.polcode.notblank")
    @Length(max = 5, message = "blno.polcode.length")
    private String polCode;

    @Schema(description = "卸货港", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.podcode.notblank")
    @Length(max = 5, message = "blno.podcode.length")
    private String podCode;

    @Schema(description = "目的地", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.delcode.notblank")
    @Length(max = 5, message = "blno.delcode.length")
    private String delCode;

    @Schema(description = "接货地名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.pordesc.notblank")
    @Length(max = 50, message = "blno.pordesc.length")
    private String porDesc;

    @Schema(description = "装货港名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.poldesc.notblank")
    @Length(max = 50, message = "blno.poldesc.length")
    private String polDesc;

    @Schema(description = "卸货港名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.poddesc.notblank")
    @Length(max = 50, message = "blno.poddesc.length")
    private String podDesc;

    @Schema(description = "目的地名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.deldesc.notblank")
    @Length(max = 50, message = "blno.deldesc.length")
    private String delDesc;

    @Schema(description = "订舱人代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.bkpcode.notblank")
    @Length(max = 50, message = "blno.bkpcode.length")
    private String bkpCode;

    @Schema(description = "订舱船名", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{blno.bkgvesselcode.notblank}")
    @Length(max = 50, message = "{blno.bkgvesselcode.length}")
    private String bkgVesselCode;

    @Schema(description = "订舱航次", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{blno.bkgvoyage.notblank}")
    @Length(max = 50, message = "{blno.bkgvoyage.length}")
    private String bkgVoyage;

    @Schema(description = "舱位代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.spaceowner.notblank")
    @Length(max = 5, message = "blno.spaceowner.length")
    private String spaceOwner;

    @Schema(description = "箱主代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.cntrowner.notblank")
    @Length(max = 5, message = "blno.cntrowner.length")
    private String cntrOwner;

    @Schema(description = "箱状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotBlank(message = "blno.cntrstatus.notblank")
    @Length(max = 1, message = "blno.cntrstatus.length")
    private String cntrStatus;

    @Schema(description = "协议号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.agreementno.notblank")
    @Length(max = 50, message = "blno.agreementno.length")
    private String agreementNo;

    @Schema(description = "运输条款", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.shippingterm.notblank")
    @Length(max = 50, message = "blno.shippingterm.length")
    private String shippingTerm;

    @Schema(description = "一代代码")
    @Length(max = 50, message = "blno.topagentcode.length")
    private String topAgentCode;

    @Schema(description = "提单主体代码")
    @Length(max = 5, message = "blno.blentity.length")
    private String blEntity;

    @Schema(description = "提单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotBlank(message = "blno.bltype.notblank")
    @Length(max = 20, message = "blno.bltype.length")
    private String blType;

    @Schema(description = "提单打印地")
    @Length(max = 5, message = "blno.issueplace.length")
    private String issuePlace;

    @Schema(description = "提单打印份数",requiredMode = Schema.RequiredMode.REQUIRED,example = "2")
    @NotNull(message = "{blno.printBlNumber.notblank}")
    private Integer printBlNumber;

    @Schema(description = "签单日期")
    private LocalDate issueDate;

    @Schema(description = "签发小船提单")
    private Boolean issueFeederBl;

    @Schema(description = "签发小船装港")
    private Boolean issueFeederPlace;

    @Schema(description = "客户要求签单类型", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "blno.signorder.notblank")
    @Length(max = 1, message = "blno.signorder.length")
    private String signOrder;

    @Schema(description = "实际签单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private String signType;

    @Schema(description = "锁单标识")
    private Boolean blLockFlag;

    @Schema(description = "D/O状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private String doStatus;

    @Schema(description = "数据来源")
    @Length(max = 64, message = "blno.datasource.length")
    private String datasource;

    @Schema(description = "si通知邮箱 （收，可多）")
    @Length(max = 300, message = "{blno.sinotifyemails.length}")
    private String siNotifyEmails;

    @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
    private String creator;

    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(description = "更新时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @Schema(description = "换单日期")
    private String doDate;

    @Schema(description = "扣单标识")
    private Boolean restrictionFlag;

    @Schema(description = "电子保函登记类型")
    private String elgReceive;

    @Schema(description = "正本保函登记类型")
    private String lgReceive;

}
